package com.mak001.lite.multiSkill.GUI.Tabs;

import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Rectangle;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class SuperHeaterTab extends JPanel{
	private static final long serialVersionUID = 1L;

	private JTextField textField6;
	private JComboBox barDropDown;
	
	String[] bars = { "bronze", "iron", "silver", "steel", "gold", "mithril",
			"adamant", "rune" };
	
	public SuperHeaterTab(){
		textField6 = new JTextField();
		barDropDown = new JComboBox();
		this.setLayout(null);

		// ---- textField6 ----
		textField6.setText("Bar Type");
		textField6.setEditable(false);
		textField6.setHorizontalAlignment(SwingConstants.CENTER);
		this.add(textField6);
		textField6.setBounds(125, 25, 115, textField6
				.getPreferredSize().height);

		// ---- barDropDown ----
		barDropDown.setModel(new DefaultComboBoxModel(bars));
		this.add(barDropDown);
		barDropDown.setBounds(125, 50, 115, barDropDown
				.getPreferredSize().height);

		{ // compute preferred size
			Dimension preferredSize = new Dimension();
			for (int i = 0; i < this.getComponentCount(); i++) {
				Rectangle bounds = this.getComponent(i)
						.getBounds();
				preferredSize.width = Math.max(bounds.x + bounds.width,
						preferredSize.width);
				preferredSize.height = Math.max(bounds.y
						+ bounds.height, preferredSize.height);
			}
			Insets insets = this.getInsets();
			preferredSize.width += insets.right;
			preferredSize.height += insets.bottom;
			this.setMinimumSize(preferredSize);
			this.setPreferredSize(preferredSize);
		}
	}

	public int getPrimary() {
		String s = barDropDown.getSelectedItem().toString();
		if (s.contains("bronze")) {
			return 436;
		} else if (s.contains("iron")) {
			return 440;
		} else if (s.contains("silver")) {
			return 442;
		} else if (s.contains("steel")) {
			return 440;
		} else if (s.contains("gold")) {
			return 444;
		} else if (s.contains("mithril")) {
			return 447;
		} else if (s.contains("adamant")) {
			return 449;
		} else { // rune
			return 451;
		}
	}
	public int getSecondary() {
		String s = barDropDown.getSelectedItem().toString();
		if (s.contains("bronze")) {
			return 438;
		} else if (s.contains("iron")) {
			return -1;
		} else if (s.contains("silver")) {
			return -1;
		} else if (s.contains("steel")) {
			return 453;
		} else if (s.contains("gold")) {
			return -1;
		} else if (s.contains("mithril")) {
			return 453;
		} else if (s.contains("adamant")) {
			return 453;
		} else { // rune
			return 453;
		}
	}

	public int getWithdraw() {
		String s = barDropDown.getSelectedItem().toString();
		if (s.contains("bronze")) {
			return 14;
		} else if (s.contains("iron")) {
			return 28;
		} else if (s.contains("silver")) {
			return 28;
		} else if (s.contains("steel")) {
			return 9;
		} else if (s.contains("gold")) {
			return 28;
		} else if (s.contains("mithril")) {
			return 5;
		} else if (s.contains("adamant")) {
			return 4;
		} else { // rune
			return 3;
		}
	}

	public String getBarName() {
		return barDropDown.getSelectedItem().toString();
	}
}
